<template>
	<view>
		<view class="title">
			<text>关联房号</text>
		</view>
		<view class="regi">
			<view><myselect :lists='lous' styles='long' @sel='injihe'></myselect></view>
			<view><myselect :lists='dans' styles='long' @sel='injihe'></myselect></view>
			<view><myselect :lists='hous' styles='long' @sel='injihe'></myselect></view>
		</view>
		<view class="tishi">
			<view>·提交后请等待审核</view>
			<view>·客服人员会在24小时内审核</view>
		</view>
		<view class="tijiao">
			<button @click="up">确认提交</button>
		</view>
	</view>
</template>

<script>
	import { reactive,toRefs} from 'vue'
	export default {
		setup(){
			let data = reactive({
				lous:['楼栋','一栋','二栋'],
				dans:['单元','一单元','二单元'],
				hous:['房号','101','102'],
				jihe:{
					lou:'',
					dan:'',
					hou:''
				},
				injihe:(e)=>{
					if(e.slice(-1)=='栋'){
						data.jihe.lou=e
					}else if(e.slice(-1)=='元'){
						data.jihe.dan=e
					}else{
						data.jihe.hou=e
					}
				},
				up:()=>{
					if(data.jihe.lou!=''&&data.jihe.dan!=''&&data.jihe.hou!=''){
						wx.showLoading({
						  title: '正在提交',
						})
						setTimeout(()=>{
							wx.hideLoading().then(()=>{
								wx.showToast({
								  title: '提交成功审核中',
								  icon:'success',
								  duration: 2000
								})
								setTimeout(()=>{
									uni.redirectTo({
										url: '/pages/wxz/login/login'
									});
								},2000)
							})
						},2000)
					}else{
						wx.hideLoading().then(()=>{
							wx.showToast({
							  title: '请选择完整',
							  icon:'error',
							  duration: 2000
							})
						})
					}
				}
			})
			return {...toRefs(data)}
		}
	}
</script>

<style scoped lang="less">
	.title{
		margin: 100rpx 0;
		text-align: center;
		
	}
	.regi{
		position: relative;
		height: 80rpx;
		display: flex;
		margin-left: -50rpx;
		justify-content: space-evenly;
		view{
			width: 150rpx;
			position: relative;
		}
	}
	.tishi{
		margin: 50rpx;
	}
	.tijiao{
		padding: 0 10rpx;
		button{
			color: white;
			background-color: #118EE9;
		}
	}
</style>
<style>
	
</style>